home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / Power Jump.lua < prev    next >
Text File  |  2010-08-09  |  2KB  |  55 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Power Jump
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, September 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.powerjump={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.powerjump.gfx_wpn=loadgfx("weapons/powerjump.png")                                -- Weapon Image
  13. setmidhandle(cc.powerjump.gfx_wpn)
  14. cc.powerjump.sfx_powerjump=loadsfx("swish.ogg")                                        -- Sound
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Power Jump
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.powerjump.id=addweapon("cc.powerjump","Power Jump",cc.powerjump.gfx_wpn,3)        -- Add Weapon (3 uses)
  21. cc.powerjump.ammo=1                                                                    -- 1 Powerjump
  22.  
  23. function cc.powerjump.draw()                                                        -- Draw
  24.     if cc.powerjump.ammo-weapon_shots>0 then
  25.         -- HUD Crosshair
  26.         hudcrosshair(6,3)
  27.     end
  28. end
  29.  
  30. function cc.powerjump.attack(attack)                                                -- Attack
  31.     if weapon_timer>0 then
  32.         weapon_timer=weapon_timer-1
  33.     end
  34.     if (weapon_shots<cc.powerjump.ammo) and (attack==1) and (weapon_timer<=0) then
  35.         -- Use weapon and allow to use another one afterwards (1)
  36.         useweapon(1)
  37.         weapon_shots=weapon_shots+1
  38.         weapon_timer=20
  39.         -- FX
  40.         playsound(cc.powerjump.sfx_powerjump)
  41.         particle(p_muzzle,getplayerx(0),getplayery(0))
  42.         particlesize(1,1)
  43.         particlecolor(255,255,0)
  44.         particlealpha(0.5)
  45.         particlefadealpha(0.03)
  46.         -- Push (absolute, don't push others)
  47.         playerpush(0,math.sin(math.rad(getplayerrotation(0)))*7.0,-math.cos(math.rad(getplayerrotation(0)))*7.0,1,0)
  48.     end
  49.     if weapon_shots>0 then
  50.         -- Avoid Falldamage
  51.         if getplayeryspeed(0)>7.0 then
  52.             playerpush(0,getplayerxspeed(0),7.0,1,0)
  53.         end
  54.     end
  55. end